<%--
  Created by IntelliJ IDEA.
  User: itlaobing
  Date: 2018/9/30
  Time: 9:35
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@taglib prefix="p" uri="http://www.itlaobing.com/page" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html lang="en">

<head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <meta name="viewport" content="width=device-width,initial-scale=1.0" />
    <meta charset="utf-8" />
    <title>品农商城-管理</title>
    <base href="<%=basePath %>">
    <link href="favicon.ico" rel="shortcut icon" type="image/x-icon" />
    <meta name="keywords" content="通州酒水,通州生鲜,通州水果,通州蔬菜,通州肉,通州蛋,通州促销活动,通州促销产品,北京通糖烟酒糖业有限公司,北京通州区超市" />
    <meta http-equiv="description" content="北京通州酒水,北京通州生鲜,北京通州促销产品等,北京通州区超市连锁,北京通州区免费送货,北京通州区正品低价、品质保障、配送及时、轻松购物,北京通州品农,北京通州品质" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
    <link rel="stylesheet" href="assets/lib/css/bootstrap.min.css" media="screen" />
    <link rel="stylesheet" href="assets/lib/css/font-awesome.min.css" />
    <link rel="stylesheet" href="assets/lib/css/metrize.css" />
    <link rel="stylesheet" href="assets/lib/css/animate.css" />
    <link rel="stylesheet" href="assets/lib/css/toastr.min.css" />
    <link rel="stylesheet" href="assets/lib/css/bootstrap-datetimepicker.min.css" />
    <link rel="stylesheet" href="assets/lib/css/chosen.min.css" />
    <link rel="stylesheet" href="assets/lib/css/main.css" />
    <link rel="stylesheet" href="assets/lib/css/slidebars.css" />
    <link rel="stylesheet" href="assets/app/css/management/application.css" />
    <!-- HTML5 shiv and Respond.js IE8 support of HTML5 elements and media \ -->
    <!--[if lt IE 9]>
    <script src="assets/lib/js/html5shiv.min.js"></script>
    <script src="assets/lib/js/respond.min.js"></script>
    <![endif]-->

    <link rel="stylesheet" href="assets/app/css/management/members.css" />

</head>

<body>
<!-- Left sidebar start -->
<%@include file="../common/left.jsp" %>
<!-- Left sidebar end -->
<!-- Dashboard Wrapper Start -->
<div class="dashboard-wrapper">
    <!-- Header start -->
    <%@include file="../common/head.jsp" %>
    <!-- Header ends -->
    <!-- Right sidebar start -->
    <!-- Right sidebar end -->
    <!-- Main Container Start -->
    <div class="main-container">
        <!-- Top Bar Starts -->
        <div class="top-bar clearfix">

            <div class="page-title">
                <h4>
                    <div class="fs1" aria-hidden="true" data-icon="&#xe0ac;"></div>
                    账号管理
                </h4>
            </div>

        </div>
        <!-- Top Bar Ends -->
        <!-- Container fluid Starts -->
        <div class="container-fluid">
            <!-- Spacer starts -->
            <div class="spacer-xs">

                <div class="row no-gutter">
                    <div class="col-md-12">
                        <div class="panel panel-default">
                            <div class="panel-heading">
                                <h4>列表</h4>
                                <ul class="links">
                                    <li>
                                        <a href="/management/user/page/create" title="新建账号">
                                            <i class="fa fa-plus"></i> 新建账号
                                        </a>
                                    </li>
                                </ul>
                            </div>
                            <div class="panel-body">
                                <div class="row">
                                    <form id="searchForm" class="form-horizontal" data-remote="true" action="/management/user/page/list" method="post">
                                        <div class="col-xs-3">
                                            <input name="condition" class="form-control" placeholder="输入系统用户姓名" type="text" value="${putil.condition}" />
                                        </div>
                                        <div class="col-xs-3">
                                            <button type="submit" class="btn btn-sm btn-success">
                                                查询
                                                <span class="fa fa-search"></span>
                                            </button>
                                        </div>
                                    </form>
                                </div>
                                <div class="data-table" style="margin-top: 10px">
                                    <table class="table table-bordered table-hover table-responsive">
                                        <tr>
                                            <td>编号</td>
                                            <td>账号</td>
                                            <td>名称</td>
                                            <td>注册时间</td>
                                            <td>最后登录时间</td>
                                            <td>状态</td>
                                            <td>系统身份</td>
                                            <td>用户头像</td>
                                            <td>操作</td>
                                        </tr>

                                        <c:if test="${empty putil.datas}">
                                            <tr>
                                                <td colspan="9" align="center">
                                                    暂无数据
                                                </td>
                                            </tr>
                                        </c:if>
                                        <c:if test="${not empty putil.datas}">
                                            <c:forEach var="en" items="${putil.datas}">
                                                <tr>
                                                    <td>
                                                            ${en.systemuserid}
                                                    </td>
                                                    <td>
                                                            ${en.systemuseraccount}
                                                    </td>
                                                    <td>
                                                            ${en.systemusername}
                                                    </td>
                                                    <td>
                                                        <span class="label label-primary">
                                                                <fmt:formatDate value="${en.systemuserdatetime}" type="both" />
                                                            </span>
                                                    </td>
                                                    <td>
                                                        <c:if test="${empty en.lastlogindatetime}">
                                                            <span class="label label-danger">还未登录</span>
                                                        </c:if>
                                                        <c:if test="${not empty en.lastlogindatetime}">
                                                            <span class="label label-primary">
                                                                <fmt:formatDate value="${en.lastlogindatetime}" type="both" />
                                                            </span>
                                                        </c:if>
                                                    </td>
                                                    <td>
                                                        <c:if test="${en.systemuserstatus==0}">
                                                            <span class="label label-success">正常</span>
                                                        </c:if>
                                                        <c:if test="${en.systemuserstatus==1}">
                                                            <span class="label label-danger">锁定</span>
                                                        </c:if>
                                                    </td>
                                                    <td>
                                                        <span class="label label-success">
                                                                ${en.systemrolename}
                                                        </span>
                                                    </td>
                                                    <td>
                                                        <c:if test="${empty en.systemuserimage}">
                                                            <img id="avatar"
                                                                 class="profile-img img-responsive center-block"
                                                                 alt="管理员" src="assets/lib/img/admin1.png" style="width: 50px;height: 50px;border-radius: 50px;"/>
                                                        </c:if>
                                                        <c:if test="${not empty en.systemuserimage}">
                                                            <img id="avatar"
                                                                 class="profile-img img-responsive center-block"
                                                                 alt="${en.systemrolename}" src="${en.systemuserimage}" style="width: 50px;height: 50px;border-radius: 50px;"/>
                                                        </c:if>
                                                    </td>
                                                    <td width="160">
                                                        <div class="btn-group">
                                                            <a class="btn btn-sm btn-info" href="/management/user/page/show/${en.systemuserid}">查看</a>
                                                            <c:if test="${loginuser.systemrolename=='超级管理员'}">
                                                                <c:if test="${loginuser.systemuserid!=en.systemuserid}">
                                                                    <c:if test="${en.systemuserstatus==0}">
                                                                        <a class="btn btn-sm btn-danger" href="/management/user/action/lock/${en.systemuserid}/1">锁定</a>
                                                                    </c:if>
                                                                    <c:if test="${en.systemuserstatus==1}">
                                                                        <a class="btn btn-sm btn-success" href="/management/user/action/lock/${en.systemuserid}/0">解锁</a>
                                                                    </c:if>

                                                                    <a class="btn btn-sm btn-warning" onclick="return confirm('是否确认删除')" href="/management/user/action/delete/${en.systemuserid}">删除</a>
                                                                </c:if>
                                                            </c:if>

                                                        </div>
                                                    </td>
                                                </tr>
                                            </c:forEach>
                                        </c:if>
                                    </table>
                                    <div>
                                    </div>
                                </div>

                                <p:page condition="${putil.condition }" pageIndex="${putil.pageIndex }" pageSize="${putil.pageSize }" actionName="/management/user/page/list" pageNums="${putil.pageNums }" hasPreOmit="${putil.hasPreOmit }" recordCount="${putil.recordCount }" hasSuffixOmit="${putil.hasSuffixOmit }"/>

                            </div>
                        </div>
                    </div>
                </div>

            </div>
            <!-- Spacer ends -->
        </div>
        <!-- Container fluid ends -->
    </div>
    <!-- Main Container Start -->
    <!-- Footer Start -->
    <%@include file="../common/foot.jsp" %>
    <!-- Footer end -->
</div>
<!-- Dashboard Wrapper End -->
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="assets/lib/js/jquery.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="assets/lib/js/bootstrap.min.js"></script>
<!-- Animated Right Sidebar -->
<script src="assets/lib/js/slidebars.js"></script>
<script src="assets/lib/js/toastr.min.js"></script>
<!-- Date time select -->
<script src="assets/lib/js/moment.min.js"></script>
<script src="assets/lib/js/moment.zh-cn.js"></script>
<script src="assets/lib/js/bootstrap-datetimepicker.min.js"></script>
<script src="assets/lib/js/chosen.jquery.min.js"></script>
<!-- Custom JS -->
<script src="assets/lib/js/custom.js"></script>
<script type="text/javascript">
    jQuery.ctx = ""; //在js中可以直接通过$.ctx来获取应用程序上下文
    jQuery.servletPath = "/management/members"; //在js中可以直接通过$.servletPath 来获取请求的路径
</script>
<script type="text/javascript" src="assets/app/js/management/application.js"></script>

<script type="text/javascript" src="/assets/app/js/management/members.js"></script>

<div id="modal-ajax" class="modal fade" tabindex="-1" role="dialog">
    <div class="modal-dialog" role="document">
        <div class="modal-content"></div>
    </div>
</div>
</body>

</html>
